<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // try  catch  尝试执行代码，如果执行成功就正常执行，如果有报错，这个报错会被捕获，就不会在控制台报错


        const  str = '{"a":1' ;

        // let s = JSON.parse(str) ;
        // console.log(s);   // 报错   Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at 17try&catch.html:18:22

        try {
            let s = JSON.parse(str) ;
            console.log(s);
        } catch(err) {
            console.log(err);    // Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at 17try&catch.html:18:22
        }


        console.log(666);

    </script>
    
</body>
</html>